import request from '@/utils/request'

// 查询题目管理列表
export function listProblem(query) {
  return request({
    url: '/problem/problem/list',
    method: 'get',
    params: query
  })
}

// 查询题目管理详细
export function getProblem(id) {
  return request({
    url: '/problem/problem/' + id,
    method: 'get'
  })
}

// 新增题目管理
export function addProblem(data) {
  return request({
    url: '/problem/problem',
    method: 'post',
    data: data
  })
}

// 修改题目管理
export function updateProblem(data) {
  return request({
    url: '/problem/problem',
    method: 'put',
    data: data
  })
}

// 删除题目管理
export function delProblem(id) {
  return request({
    url: '/problem/problem/' + id,
    method: 'delete'
  })
}
export function submitCode(data) {
  return request({ url: '/judge/submission', method: 'post', data })
}

export function getSubmissionResult(submissionId) {
  console.log('调用 getSubmissionResult, submissionId:', submissionId) // 调试
  return request({
    url: `/judge/submission/${submissionId}`,
    method: 'get'
  })
}
